package cn.sdormitory.workflow.dao;

import cn.sdormitory.workflow.entity.StuLeaveApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: lx
 * @date: 2023/11/9 15:59
 * @description:
 */
@Mapper
@Component
public interface StuLeaveApplyDao extends BaseMapper<StuLeaveApply> {

    List<StuLeaveApply> getLeaveApplyByStuIdAndLeaDate(Long studentId, String startDate, String endDate);
    
    /**
     * 根据学生id和请假开始时间和结束时间查看当前是否有请假记录
     * @author alex
     * @param: studentId
     * @param: startDate
     * @param: endDate
     * @date 2024/10/24 9:46
     * @return
     */
    List<StuLeaveApply> getLeaveApplyByStuIdAndLeaveDate(Long studentId, String startDate, String endDate);

    List<StuLeaveApply> getStuLeaveApply(@Param("clsTeacherId") Long clsTeacherId,
                                         @Param("status") String status,
                                         @Param("classId") Long classId);

    List<StuLeaveApply> studentLeaveCorrelationInfo(@Param("studentId") Long studentId);


    /**
     * 过期请假直接驳回
     * @return
     */
    int updatePastDueLeave(@Param("classId") Long classId,@Param("studentId") Long studentId);



    List<StuLeaveApply> stuLeaveApply(@Param("clsTeacherId") Long clsTeacherId,
                                         @Param("status") String status,
                                         @Param("classId") Long classId);

}
